/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package gamedsl2.impl;

import gamedsl2.Gamedsl2Package;
import gamedsl2.Sprite;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Sprite</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link gamedsl2.impl.SpriteImpl#getName <em>Name</em>}</li>
 *   <li>{@link gamedsl2.impl.SpriteImpl#getImage <em>Image</em>}</li>
 *   <li>{@link gamedsl2.impl.SpriteImpl#getTileWidth <em>Tile Width</em>}</li>
 *   <li>{@link gamedsl2.impl.SpriteImpl#getTileHeight <em>Tile Height</em>}</li>
 *   <li>{@link gamedsl2.impl.SpriteImpl#getSpacing <em>Spacing</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SpriteImpl extends EObjectImpl implements Sprite {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getImage() <em>Image</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getImage()
	 * @generated
	 * @ordered
	 */
	protected static final String IMAGE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getImage() <em>Image</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getImage()
	 * @generated
	 * @ordered
	 */
	protected String image = IMAGE_EDEFAULT;

	/**
	 * The default value of the '{@link #getTileWidth() <em>Tile Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileWidth()
	 * @generated
	 * @ordered
	 */
	protected static final int TILE_WIDTH_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getTileWidth() <em>Tile Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileWidth()
	 * @generated
	 * @ordered
	 */
	protected int tileWidth = TILE_WIDTH_EDEFAULT;

	/**
	 * The default value of the '{@link #getTileHeight() <em>Tile Height</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileHeight()
	 * @generated
	 * @ordered
	 */
	protected static final int TILE_HEIGHT_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getTileHeight() <em>Tile Height</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTileHeight()
	 * @generated
	 * @ordered
	 */
	protected int tileHeight = TILE_HEIGHT_EDEFAULT;

	/**
	 * The default value of the '{@link #getSpacing() <em>Spacing</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSpacing()
	 * @generated
	 * @ordered
	 */
	protected static final int SPACING_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getSpacing() <em>Spacing</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSpacing()
	 * @generated
	 * @ordered
	 */
	protected int spacing = SPACING_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SpriteImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Gamedsl2Package.Literals.SPRITE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.SPRITE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getImage() {
		return image;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setImage(String newImage) {
		String oldImage = image;
		image = newImage;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.SPRITE__IMAGE, oldImage, image));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getTileWidth() {
		return tileWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTileWidth(int newTileWidth) {
		int oldTileWidth = tileWidth;
		tileWidth = newTileWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.SPRITE__TILE_WIDTH, oldTileWidth, tileWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getTileHeight() {
		return tileHeight;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTileHeight(int newTileHeight) {
		int oldTileHeight = tileHeight;
		tileHeight = newTileHeight;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.SPRITE__TILE_HEIGHT, oldTileHeight, tileHeight));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getSpacing() {
		return spacing;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSpacing(int newSpacing) {
		int oldSpacing = spacing;
		spacing = newSpacing;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Gamedsl2Package.SPRITE__SPACING, oldSpacing, spacing));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Gamedsl2Package.SPRITE__NAME:
				return getName();
			case Gamedsl2Package.SPRITE__IMAGE:
				return getImage();
			case Gamedsl2Package.SPRITE__TILE_WIDTH:
				return getTileWidth();
			case Gamedsl2Package.SPRITE__TILE_HEIGHT:
				return getTileHeight();
			case Gamedsl2Package.SPRITE__SPACING:
				return getSpacing();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Gamedsl2Package.SPRITE__NAME:
				setName((String)newValue);
				return;
			case Gamedsl2Package.SPRITE__IMAGE:
				setImage((String)newValue);
				return;
			case Gamedsl2Package.SPRITE__TILE_WIDTH:
				setTileWidth((Integer)newValue);
				return;
			case Gamedsl2Package.SPRITE__TILE_HEIGHT:
				setTileHeight((Integer)newValue);
				return;
			case Gamedsl2Package.SPRITE__SPACING:
				setSpacing((Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Gamedsl2Package.SPRITE__NAME:
				setName(NAME_EDEFAULT);
				return;
			case Gamedsl2Package.SPRITE__IMAGE:
				setImage(IMAGE_EDEFAULT);
				return;
			case Gamedsl2Package.SPRITE__TILE_WIDTH:
				setTileWidth(TILE_WIDTH_EDEFAULT);
				return;
			case Gamedsl2Package.SPRITE__TILE_HEIGHT:
				setTileHeight(TILE_HEIGHT_EDEFAULT);
				return;
			case Gamedsl2Package.SPRITE__SPACING:
				setSpacing(SPACING_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Gamedsl2Package.SPRITE__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case Gamedsl2Package.SPRITE__IMAGE:
				return IMAGE_EDEFAULT == null ? image != null : !IMAGE_EDEFAULT.equals(image);
			case Gamedsl2Package.SPRITE__TILE_WIDTH:
				return tileWidth != TILE_WIDTH_EDEFAULT;
			case Gamedsl2Package.SPRITE__TILE_HEIGHT:
				return tileHeight != TILE_HEIGHT_EDEFAULT;
			case Gamedsl2Package.SPRITE__SPACING:
				return spacing != SPACING_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", image: ");
		result.append(image);
		result.append(", tileWidth: ");
		result.append(tileWidth);
		result.append(", tileHeight: ");
		result.append(tileHeight);
		result.append(", spacing: ");
		result.append(spacing);
		result.append(')');
		return result.toString();
	}

} //SpriteImpl
